package com.project.service;

import java.util.List;

import com.project.dao.ContactDao;
import com.project.entity.Contact;
import com.project.util.DateUtil;
import com.project.util.PKUtil;

public class ContactService {
	ContactDao cd=new ContactDao();
	public void save(String name, String company, String moblie, String tel,
			String email, String address, String web, String weibo, String cont,String projectid) {
		Contact contact=new Contact();
		contact.setId(PKUtil.getId());
		contact.setAddress(address);
		contact.setCompany(company);
		contact.setCont(cont);
		contact.setCreatetime(DateUtil.getNow());
		contact.setEmail(email);
		contact.setMoblie(moblie);
		contact.setName(name);
		contact.setTel(tel);
		contact.setWeb(web);
		contact.setWeibo(weibo);
		contact.setProjectid(projectid);
		
		
		cd.save(contact);
		
	}

	public List<Contact> findAllContactByProjectid(String projectid) {
		return  cd.findAllContactByProjectid(projectid);
		
	}

	public void update(String name, String company, String moblie, String tel,
			String email, String address, String web, String weibo,
			String cont, String projectid,String cid) {
		
		Contact contact=new Contact();
		contact.setId(cid);
		contact.setAddress(address);
		contact.setCompany(company);
		contact.setCont(cont);
		contact.setCreatetime(DateUtil.getNow());
		contact.setEmail(email);
		contact.setMoblie(moblie);
		contact.setName(name);
		contact.setTel(tel);
		contact.setWeb(web);
		contact.setWeibo(weibo);
		contact.setProjectid(projectid);
		
		cd.update(contact);
		
		
				
	}

	public void delContactById(String cid) {
		cd.delContactById(cid);
	}

	public Contact findContactById(String id) {
		return cd.findContactById(id);
	}

	

	
	
}
